<include file="public/layout" />
<!--物流配置 css -start-->
<style>
    ul.group-list {
        width: 96%;min-width: 1000px; margin: auto 5px;list-style: disc outside none;
    }
    ul.group-list li {
        white-space: nowrap;float: left;
        width: 150px; height: 25px;
        padding: 3px 5px;list-style-type: none;
        list-style-position: outside;border: 0px;margin: 0px;
    }
    .row .table-bordered td .btn,.row .table-bordered td img{
        vertical-align: middle;
    }
    .row .table-bordered td{
      padding: 8px;
      line-height: 1.42857143;
    }
    .table-bordered{
      width: 100%
    }
    .table-bordered tr td{
      border: 1px solid #f4f4f4;
    }
    .btn-success {
        color: #fff;
        background-color: #449d44;
        border-color: #398439 solid 1px;
    }
    .btn {
    display: inline-block;
    padding: 6px 12px;
    margin-bottom: 0;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.42857143;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    -ms-touch-action: manipulation;
    touch-action: manipulation;
    cursor: pointer;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    background-image: none;
    border: 1px solid transparent;
    border-radius: 4px;
}
.col-xs-8 {
    width: 66.66666667%;
}
.col-xs-4 {
    width: 33.33333333%;
}
.col-xs-1, .col-xs-10, .col-xs-11, .col-xs-12, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9 {
    float: left;
}
.row .tab-pane h4{
  padding: 10px 0;
}
.row .tab-pane h4 input{
  vertical-align: middle;
} 
.table-striped>tbody>tr:nth-of-type(odd) {
    background-color: #f9f9f9;
}
.ncap-form-default .title{
  border-bottom: 0
}
.ncap-form-default dl.row, .ncap-form-all dd.opt{
    /*border-color: #F0F0F0;*/
    border: none;
}
.ncap-form-default dl.row:hover, .ncap-form-all dd.opt:hover{
    border: none;
    box-shadow: inherit;
}
</style>
<!--物流配置 css -end-->
<!--以下是在线编辑器 代码 -->
<script type="text/javascript">
    /*
	 * 在线编辑器相 关配置 js 
	 *  参考 地址 http://fex.baidu.com/ueditor/
	 */
    window.UEDITOR_Admin_URL = "/public/plugins/Ueditor/";
    var URL_upload = "/index.php/admin/Ueditor/imageUp/savepath/goods.html";
    var URL_fileUp = "/index.php/admin/Ueditor/fileUp/savepath/article.html";
    var URL_scrawlUp = "/index.php/admin/Ueditor/scrawlUp/savepath/article.html";
    var URL_getRemoteImage = "/index.php/admin/Ueditor/getRemoteImage/savepath/article.html";
    var URL_imageManager = "/index.php/admin/Ueditor/imageManager/savepath/article.html";
    var URL_imageUp = "/index.php/admin/Ueditor/imageUp/savepath/article.html";
    var URL_getMovie = "/index.php/admin/Ueditor/getMovie/savepath/article.html";
    var URL_home = "";
</script>
<script type="text/javascript" charset="utf-8" src="/public/plugins/Ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="/public/plugins/Ueditor/ueditor.all.min.js"> </script>
 <script type="text/javascript" charset="utf-8" src="/public/plugins/Ueditor/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript">  
  
    var editor;
    $(function () {
        //具体参数配置在  editor_config.js  中
        var options = {
            zIndex: 999,
            initialFrameWidth: "95%", //初化宽度
            initialFrameHeight: 400, //初化高度
            focus: false, //初始化时，是否让编辑器获得焦点true或false
            maximumWords: 99999, removeFormatAttributes: 'class,style,lang,width,height,align,hspace,valign'
            , //允许的最大字符数 'fullscreen',
            pasteplain:false, //是否默认为纯文本粘贴。false为不使用纯文本粘贴，true为使用纯文本粘贴
            autoHeightEnabled: true
         /*   autotypeset: {
                mergeEmptyline: true,        //合并空行
                removeClass: true,           //去掉冗余的class
                removeEmptyline: false,      //去掉空行
                textAlign: "left",           //段落的排版方式，可以是 left,right,center,justify 去掉这个属性表示不执行排版
                imageBlockLine: 'center',    //图片的浮动方式，独占一行剧中,左右浮动，默认: center,left,right,none 去掉这个属性表示不执行排版
                pasteFilter: false,          //根据规则过滤没事粘贴进来的内容
                clearFontSize: false,        //去掉所有的内嵌字号，使用编辑器默认的字号
                clearFontFamily: false,      //去掉所有的内嵌字体，使用编辑器默认的字体
                removeEmptyNode: false,      //去掉空节点
                                             //可以去掉的标签
                removeTagNames: {"font": 1},
                indent: false,               // 行首缩进
                indentValue: '0em'           //行首缩进的大小
            }*/,
        	toolbars: [
                   ['fullscreen', 'source', '|', 'undo', 'redo',
                       '|', 'bold', 'italic', 'underline', 'fontborder',
                       'strikethrough', 'superscript', 'subscript',
                       'removeformat', 'formatmatch', 'autotypeset',
                       'blockquote', 'pasteplain', '|', 'forecolor',
                       'backcolor', 'insertorderedlist',
                       'insertunorderedlist', 'selectall', 'cleardoc', '|',
                       'rowspacingtop', 'rowspacingbottom', 'lineheight', '|',
                       'customstyle', 'paragraph', 'fontfamily', 'fontsize',
                       '|', 'directionalityltr', 'directionalityrtl',
                       'indent', '|', 'justifyleft', 'justifycenter',
                       'justifyright', 'justifyjustify', '|', 'touppercase',
                       'tolowercase', '|', 'link', 'unlink', 'anchor', '|',
                       'imagenone', 'imageleft', 'imageright', 'imagecenter',
                       '|', 'insertimage', 'emotion', 'insertvideo',
                       'attachment', 'map', 'gmap', 'insertframe',
                       'insertcode', 'webapp', 'pagebreak', 'template',
                       'background', '|', 'horizontal', 'date', 'time',
                       'spechars', 'wordimage', '|',
                       'inserttable', 'deletetable',
                       'insertparagraphbeforetable', 'insertrow', 'deleterow',
                       'insertcol', 'deletecol', 'mergecells', 'mergeright',
                       'mergedown', 'splittocells', 'splittorows',
                       'splittocols', '|', 'print', 'preview', 'searchreplace']
               ]
        };
        editor = new UE.ui.Editor(options);
        editor.render("goods_content");  //  指定 textarea 的  id 为 goods_content

    }); 
</script>
<!--以上是在线编辑器 代码  end-->
<body style="background-color: #FFF; overflow: auto;">
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page">
    <div class="fixed-bar">
        <div class="item-title">
            <div class="subject">
                <h3>添加定制商品</h3>
            </div>
            <ul class="tab-base nc-row">
                <li><a href="javascript:void(0);" data-index='1' class="tab current"><span>通用信息</span></a></li>
                <li><a href="javascript:void(0);" data-index='2' class="tab"><span>商品相册</span></a></li>
                <li><a href="javascript:void(0);" data-index='3' class="tab"><span>荣誉证书</span></a></li>
                <li><a href="javascript:void(0);" data-index='4' class="tab"><span>商品物流</span></a></li>                
            </ul>
        </div>
    </div>
    <!-- 操作说明 -->
    <div class="explanation" id="explanation">
        <div class="title" id="checkZoom"><i class="fa fa-lightbulb-o"></i>
            <h4 title="提示相关设置操作时应注意的要点">操作提示</h4>
            <span id="explanationZoom" title="收起提示"></span> </div>
        <ul>
            <li>请务必正确填写商品信息</li>
        </ul>
    </div>
    <!--表单数据-->
    <form method="post" action="{:U('Destine/addeditGoods')}" class="form-horizontal" id="addEditGoodsForm">

<!--通用信息-->
        <div class="ncap-form-default tab_div_1">
            <dl class="row">
                <dt class="tit">
                    <label for="record_no">商品名称</label>
                </dt>
                <dd class="opt">
                    <input type="text" value="{$goodsInfo.goods_name}" name="goods_name" class="input-txt"/>
                    <span class="err" id="err_goods_name" style="color:#F00; display:none;"></span>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="record_no">定制主题</label>
                </dt>
                <dd class="opt">
                      <select name="theme_id" class="small form-control">
                        <option value="0">请选择定制主题</option>                                      
                             <foreach name="theme" item="v" key="k" >                                                                                          
                               <option value="{$v['id']}" <if $v['id'] eq $goodsInfo['theme_id']>selected="selected"</if> >
                                    {$v['title']}
                               </option>
                             </foreach>
                      </select>             
                    <span class="err" id="err_cat_id" style="color:#F00; display:none;"></span>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="record_no">原厂地酒厂</label>
                </dt>
                <dd class="opt">
                      <select name="winery_id" id="winery_id" class="small form-control">
                        <option value="0">请选择原厂地酒厂</option>                                      
                             <foreach name="suppliers" item="v" key="k" >                                                                                          
                               <option value="{$v['suppliers_id']}" <if  $v['suppliers_id'] eq $goodsInfo['winery_id']>selected="selected"</if> >
                                    {$v['suppliers_name']}
                               </option>
                             </foreach>
                      </select>             
                    <span class="err" id="err_winery_id" style="color:#F00; display:none;"></span>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="record_no">香型</label>
                </dt>
                <dd class="opt">
                      <select name="aroma_id" id="aroma_id" class="small form-control">
                        <option value="0">请选择香型</option>                                      
                             <foreach name="aroma" item="v" key="k" >                                                                                          
                               <option value="{$v['id']}" <if $v['id'] eq $goodsInfo['aroma_id']>selected="selected"</if> >
                                    {$v['title']}
                               </option>
                             </foreach>
                      </select>             
                    <span class="err" id="err_aroma_id" style="color:#F00; display:none;"></span>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="record_no">酒精度</label>
                </dt>
                <dd class="opt">
                    <input type="text" value="{$goodsInfo.degree}" name="degree" class="input-txt"/> 度
                    <span class="err" id="err_goods_degree" style="color:#F00; display:none;"></span>                
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="record_no">年限</label>
                </dt>
                <dd class="opt">
                    <input type="text" value="{$goodsInfo.years}" name="years" class="input-txt"/> 年
                    <span class="err" id="err_goods_years" style="color:#F00; display:none;"></span>                
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="record_no">净含量</label>
                </dt>
                <dd class="opt">
                	<foreach name="quantity" item="vo" key="k">
                	<input type="checkbox" value="{$vo.id}" name="quantity[]" <if is_array($goodsInfo.quantity)&&in_array($vo.id,$goodsInfo.quantity)>checked="checked"</if>>{$vo.val}L  &nbsp;
                	</foreach>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="record_no">原料</label>
                </dt>
                <dd class="opt">
                    <input type="text" value="{$goodsInfo.material}" name="material" class="input-txt"/>
                    <span class="err" id="err_goods_material" style="color:#F00; display:none;"></span>                
                </dd>
            </dl>
            <dl class="row">
		        <dt class="tit">
		          <label for="t_mane"><em>*</em>生产时间</label>
		        </dt>
		        <dd class="opt">
		          <input type="text" placeholder="选择生产时间" class="input-txt" id="productiontime" name="productiontime" value="<if !empty($goodsInfo.productiontime)>{$goodsInfo.productiontime|date='Y/m/d H:i:s',###}</if>">
		          <script type="text/javascript">
			        	$('#productiontime').datetimepicker({step:10});
			        </script>
		        </dd>
		    </dl>
		    <dl class="row">
                <dt class="tit">
                    <label for="record_no">条形码</label>
                </dt>
                <dd class="opt">
                    <input type="text" value="{$goodsInfo.bar_code}" name="bar_code" class="input-txt"/>
                    <span class="err" id="err_bar_code" style="color:#F00; display:none;"></span>                
                </dd>
            </dl>    
            <dl class="row">
                <dt class="tit">
                    <label for="record_no">生产许可证编号</label>
                </dt>
                <dd class="opt">
                    <input type="text" value="{$goodsInfo.licence_code}" name="licence_code" class="input-txt"/>
                    <span class="err" id="err_licence_code" style="color:#F00; display:none;"></span>                
                </dd>
            </dl> 
            <dl class="row">
                <dt class="tit">
                    <label for="record_no">产品标准号及等级</label>
                </dt>
                <dd class="opt">
                    <input type="text" value="{$goodsInfo.grade}" name="grade" class="input-txt"/>
                    <span class="err" id="err_grade" style="color:#F00; display:none;"></span>                
                </dd>
            </dl> 
			<dl class="row">
                <dt class="tit">
                    <label for="record_no">商品货号</label>
                </dt>
                <dd class="opt">
                    <input type="text" value="{$goodsInfo.goods_sn}" name="goods_sn" class="input-txt"/>
                    <span class="err" id="err_goods_sn" style="color:#F00; display:none;"></span>                
                    <p class="notic">如果不填会自动生成</p>
                </dd>
            </dl>     
            <dl class="row">
                <dt class="tit">
                    <label for="record_no">本店售价</label>
                </dt>
                <dd class="opt">
                    <input type="text" value="{$goodsInfo.shop_price}" name="shop_price" class="t_mane" onKeyUp="this.value=this.value.replace(/[^\d.]/g,'')" onpaste="this.value=this.value.replace(/[^\d.]/g,'')" />
                    <span class="err" id="err_shop_price" style="color:#F00; display:none;"></span>
                </dd>
            </dl>             
            <dl class="row">
                <dt class="tit">
                    <label for="record_no">市场价</label>
                </dt>
                <dd class="opt">
                    <input type="text" value="{$goodsInfo.market_price}" name="market_price" class="t_mane" onKeyUp="this.value=this.value.replace(/[^\d.]/g,'')" onpaste="this.value=this.value.replace(/[^\d.]/g,'')" />
                    <span class="err" id="err_market_price" style="color:#F00; display:none;"></span>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="record_no">减免金额</label>
                </dt>
                <dd class="opt">
                    <input type="text" value="{$goodsInfo.deduction_amount}" name="deduction_amount" class="t_mane" onKeyUp="this.value=this.value.replace(/[^\d.]/g,'')" onpaste="this.value=this.value.replace(/[^\d.]/g,'')" />
                    <span class="err" id="err_deduction_amount" style="color:#F00; display:none;"></span>
                    <p class="notic">实际成交价为本店售价-减免金额</p>
                </dd>
            </dl> 
            <dl class="row">
                <dt class="tit">
                    <label for="record_no">可用银酒币抵用现金范围</label>
                </dt>
                <dd class="opt">
                    <input type="text" value="{$goodsInfo.d_start}" name="d_start" class="t_mane" onKeyUp="this.value=this.value.replace(/[^\d.]/g,'')" onpaste="this.value=this.value.replace(/[^\d.]/g,'')" />
                    至 <input type="text" value="{$goodsInfo.d_end}" name="d_end" class="t_mane" onKeyUp="this.value=this.value.replace(/[^\d.]/g,'')" onpaste="this.value=this.value.replace(/[^\d.]/g,'')" />
                </dd>
            </dl>    
            <dl class="row">
                <dt class="tit">
                    <label for="record_no">购买赠送银酒币</label>
                </dt>
                <dd class="opt">
                    <input type="text" value="{$goodsInfo.give_integral}" name="give_integral" class="t_mane" onKeyUp="this.value=this.value.replace(/[^\d.]/g,'')" onpaste="this.value=this.value.replace(/[^\d.]/g,'')" />
                    <span class="err" id="err_give_integral" style="color:#F00; display:none;"></span>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="record_no">库存数量</label>
                </dt>
                <dd class="opt">                
                    <if condition="$goodsInfo[goods_id] gt 0">
                        <input type="text" value="{$goodsInfo.store_count}" class="t_mane" name="store_count" onKeyUp="this.value=this.value.replace(/[^\d.]/g,'')" onpaste="this.value=this.value.replace(/[^\d.]/g,'')" />
                    <else />
                        <input type="text" value="{$tpshop_config[basic_default_storage]}" class="t_mane" name="store_count" onKeyUp="this.value=this.value.replace(/[^\d.]/g,'')" onpaste="this.value=this.value.replace(/[^\d.]/g,'')" />                                         
                    </if>
                    <span class="err" id="err_store_count" style="color:#F00; display:none;"></span>
                </dd>
            </dl> 
			<dl class="row">
		        <dt class="tit">图片上传</dt>
		        <dd class="opt">
		          <div class="input-file-show" id="divComUploadContainer">
		            <span class="show">
		                <a class="nyroModal" rel="gal" href="{$goodsInfo.original_img}">
		                    <i class="fa fa-picture-o" onMouseOver="layer.tips('<img src={$goodsInfo.original_img}>',this ,{tips: [1, '#fff']});" onMouseOut="layer.closeAll();"></i>
		                </a>
		            </span>             
		            <span class="type-file-box">            
		            <input type="text" id="imagetext" name="original_img" value="{$goodsInfo.original_img}" class="type-file-text">            
		            <input type="button" class="type-file-button" onClick="GetUploadify(1,'imagetext','goods','')" value="上传图片"  hidefocus="true" nc_type="change_site_logo" title="点击前方预览图可查看大图，点击按钮选择文件并提交表单后上传生效"/>
		            </span>
		          </div>
		          <div id="thumbnails" class="ncap-thumb-list">
		            <h5><i class="fa fa-exclamation-circle"></i> 请上传图片格式文件。</h5>
		            <ul>
		            </ul>
		          </div>
		        </dd>
		    </dl>            
	        <dl class="row">
	            <dt class="tit">
	                <label for="record_no">商品关键词</label>
	            </dt>
	            <dd class="opt">
	                <input type="text" value="{$goodsInfo.keywords}" name="keywords" class="input-txt"/>
	                <span class="err" id="err_keywords" style="color:#F00; display:none;"></span>
	            </dd>
	        </dl>     
	         <dl class="row">
                <dt class="tit">
                    <label for="record_no">商品重量</label>
                </dt>
                <dd class="opt">
                    <input type="text" value="{$goodsInfo.weight}" name="weight" class="t_mane" onKeyUp="this.value=this.value.replace(/[^\d.]/g,'')" onpaste="this.value=this.value.replace(/[^\d.]/g,'')" />
                    <span class="err" id="err_weight" style="color:#F00; display:none;"></span>
                    <p class="notic"> 务必设置商品重量, 用于技术物流费.</p>
                </dd>
            </dl>    
	        <dl class="row">
                <dt class="tit">
                    <label for="record_no">是否提供小样</label>
                </dt>
                <dd class="opt">
                	<input type="radio" value="0" name="is_sample" <if $goodsInfo.is_sample==0>checked="checked"</if> >否 
                	<input type="radio" value="1" name="is_sample" <if $goodsInfo.is_sample==1>checked="checked"</if> >是
                </dd>
            </dl>
            <dl class="row">
		        <dt class="tit">
		          <label>是否参与分销</label>
		        </dt>
		        <dd class="opt">
		          <div class="onoff">
		            <label for="is_distribut1" class="cb-enable <if condition="$goodsInfo[is_distribut] eq 1">selected</if>">是</label>
		            <label for="is_distribut0" class="cb-disable <if condition="$goodsInfo[is_distribut] eq 0">selected</if>">否</label>
		            <input id="is_distribut1" name="is_distribut" value="1" type="radio" <if condition="$goodsInfo[is_distribut] eq 1"> checked="checked"</if>>
		            <input id="is_distribut0" name="is_distribut" value="0" type="radio" <if condition="$goodsInfo[is_distribut] eq 0"> checked="checked"</if>>
		          </div>
		          <p class="notic"></p>
		        </dd>
		    </dl>
            <dl class="row">
	            <dt class="tit">
	                <label for="record_no">设置定制模板</label>
	            </dt>
	            <dd class="opt">
                    <!--<select name="tmp_url" id="tmp_url" class="small form-control">
                        <option value="0">请选择模板</option>                                      
                             <foreach name="destmp" item="v" key="k" >                                                                                          
                               <option value="{$v['id']}" <if $v['id'] eq $goodsInfo['tmp_url']>selected="selected"</if> >
                                    {$v['title']}
                               </option>
                             </foreach>
                    </select>             -->
                    <span onclick="$('#mbsz').toggle()" style="border: #C4C4C4 solid 1px; padding: 3px 5px; cursor: pointer; border-radius: 2px;">立即设置</span>
                    <if $goodsInfo['goods_id']><a href="{:U('Mobile/Destine/goodsDestine',array('goods_id'=>$goodsInfo['goods_id']))}">预览</a></if> 
                    <div class="mbsz" id="mbsz" style="display: none; border: solid #00733E 3px; border-radius: 5px; width: 600px; margin-top: 10px;">
                    	<dl class="row">
				            <dt class="tit">
				                <label for="record_no">上传背景素材</label>
				            </dt>
				            <dd class="opt">
				            	<div class="input-file-show" id="divComUploadContainer">
						            <span class="show">
						                <a class="nyroModal" rel="gal" href="{$goodsInfo.tmp_info.img_bg}">
						                    <i class="fa fa-picture-o" onMouseOver="layer.tips('<img src={$goodsInfo.tmp_info.img_bg}>',this ,{tips: [1, '#fff']});" onMouseOut="layer.closeAll();"></i>
						                </a>
						            </span>             
						            <span class="type-file-box">            
						            <input type="text" id="des_imagetext" name="tmp_info[img_bg]" value="{$goodsInfo.tmp_info.img_bg}" class="type-file-text">            
						            <input type="button" class="type-file-button" onClick="GetUploadify(1,'des_imagetext','destine','')" value="上传图片"  hidefocus="true" nc_type="change_site_logo" title="点击前方预览图可查看大图，点击按钮选择文件并提交表单后上传生效"/>
						            </span>
						        </div>
						        <div id="thumbnails" class="ncap-thumb-list">
						            <h5><i class="fa fa-exclamation-circle"></i> 请上传PNG格式的图片。</h5>
						            <ul>
						            </ul>
						        </div>
				            </dd>	
				        </dl>
				        <dl class="row">
					        <dt class="tit">
				                <label for="record_no">背景素材高度</label>
				            </dt>
				            <dd class="opt">
				                <input type="text" value="{$goodsInfo.tmp_info.img_height}" name="tmp_info[img_height]" class="input-txt"/>
				                <span class="err" id="err_img_height" style="color:#F00; display:none;"></span>
				            </dd>
			            </dl>
			            <dl class="row">
					        <dt class="tit">
				                <label for="record_no">背景素材宽度</label>
				            </dt>
				            <dd class="opt">
				                <input type="text" value="{$goodsInfo.tmp_info.img_width}" name="tmp_info[img_width]" class="input-txt"/>
				                <span class="err" id="err_img_width" style="color:#F00; display:none;"></span>
				            </dd>
			            </dl>
			            <dl class="row">
			                <dt class="tit">
			                    <label for="record_no">页面样式</label>
			                </dt>
			                <dd class="opt">
			                	<input type="radio" value="0" name="tmp_info[pagestyle]" <if $goodsInfo.tmp_info.pagestyle_==0>checked="checked"</if> >默认 
			                	<input type="radio" value="1" name="tmp_info[pagestyle]" <if $goodsInfo.tmp_info.pagestyle ==1>checked="checked"</if> >泸州老窖
			                </dd>
			            </dl>
                    </div>
               </dd>
	        </dl>       
	        <dl class="row">
	            <dt class="tit">
	                <label for="record_no">商品详情描述</label>
	            </dt>
	            <dd class="opt">                    
	                <textarea class="span12 ckeditor" id="goods_content" name="goods_content" title="">{$goodsInfo.goods_content}</textarea>
	                <span class="err" id="err_goods_content" style="color:#F00; display:none;"></span>                    
	            </dd>
	        </dl>                                                                                                                                           
        </div>
<!--通用信息-->
<!-- 商品相册-->        
		<div class="ncap-form-default tab_div_2" style="display:none;">
            <dl class="row">
                
                <div class="tab-pane" id="tab_goods_images">
                    <table class="table table-bordered">
                        <tbody>
                        <tr>                                    
                            <td>                                    
                            <foreach name="goodsImages" item="vo" key="k" >
                                <div style="width:100px; text-align:center; margin: 5px; display:inline-block;" class="goods_xc">
                                    <input type="hidden" value="{$vo['image_url']}" name="goods_images[]">
                                    <a onClick="" href="{$vo['image_url']}" target="_blank"><img width="100" height="100" src="{$vo['image_url']}"></a>
                                    <br>
                                    <a href="javascript:void(0)" onClick="ClearPicArr2(this,'{$vo['image_url']}')">删除</a>
                                </div>
                            </foreach>
                            
                                <div class="goods_xc" style="width:100px; text-align:center; margin: 5px; display:inline-block;">
                                    <input type="hidden" name="goods_images[]" value="" />
                                    <a href="javascript:void(0);" onClick="GetUploadify(10,'','goods','call_back2');"><img src="/public/images/add-button.jpg" width="100" height="100" /></a>
                                    <br/>
                                    <a href="javascript:void(0)">&nbsp;&nbsp;</a>
                                </div>                                        
                            </td>
                        </tr>                                              
                        </tbody>
                    </table>
                </div>
                
            </dl>             
        </div>   
<!-- 商品相册-->
<!-- 荣誉证书-->
		<div class="ncap-form-default tab_div_3" style="display:none;">
            <dl class="row">

                <div class="tab-pane" id="tab_goods_honor_images">
                    <table class="table table-bordered">
                        <tbody>
                        <tr>                                    
                            <td>                                    
                            <foreach name="$goodsInfo.honor_images" item="vo" key="k" >
                                <div style="width:100px; text-align:center; margin: 5px; display:inline-block;" class="goods_xc_honor">
                                    <input type="hidden" value="{$vo}" name="honor_images[]">
                                    <a onClick="" href="{$vo}" target="_blank"><img width="100" height="100" src="{$vo}"></a>
                                    <br>
                                    <a href="javascript:void(0)" onClick="ClearPicArr3(this,'{$vo}')">删除</a>
                                </div>
                            </foreach>
                            
                                <div class="goods_xc_honor" style="width:100px; text-align:center; margin: 5px; display:inline-block;">
                                    <input type="hidden" name="honor_images[]" value="" />
                                    <a href="javascript:void(0);" onClick="GetUploadify(10,'','goods','call_back3');"><img src="/public/images/add-button.jpg" width="100" height="100" /></a>
                                    <br/>
                                    <a href="javascript:void(0)">&nbsp;&nbsp;</a>
                                </div>                                        
                            </td>
                        </tr>                                              
                        </tbody>
                    </table>
                </div>
                
            </dl>             
        </div>   
<!-- 荣誉证书-->         
<!-- 商品物流-->
		<div class="ncap-form-default tab_div_4" style="display:none;">
            <dl class="row">
                        <div class="tab-pane" id="tab_goods_shipping">
                            <h4><b>物流配送：</b><input type="checkbox" onClick="choosebox(this)">全选</h4>
                            <table class="table table-bordered table-striped dataTable" id="goods_shipping_table">
                                <foreach name="plugin_shipping" item="shipping" key="kk">
                                    <tr>
                                        <td class="title left" style="padding-right:50px;">
                                            <b>{$shipping[name]}：</b>
                                            <label class="right"><input type="checkbox" value="1" cka="mod-{$kk}">全选</label>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <ul class="group-list">
                                                <foreach name="shipping_area" item="vv">
                                                    <if condition="$vv[shipping_code] eq $shipping[code]">
                                                        <li><label><input type="checkbox" name="shipping_area_ids[]" value="{$vv.shipping_area_id}" <if condition="in_array($vv['shipping_area_id'],$goods_shipping_area_ids)">checked='checked='</if> ck="mod-{$kk}">{$vv.shipping_area_name}</label></li>
                                                    </if>
                                                </foreach>
                                                <div class="clear-both"></div>
                                            </ul>
                                        </td>
                                    </tr>
                                </foreach>
                            </table>
                        </div>                
            </dl>             
        </div>   
<!-- 商品物流-->
        <if !empty($goodsInfo)>
        	<input type="hidden" value="{$goodsInfo.goods_id}" name="id">
        </if>
		<div class="ncap-form-default">        
            <div class="bot">            
                <input type="hidden" name="__token__" value="{$Request.token}" />
                <a href="JavaScript:void(0);" class="ncap-btn-big ncap-btn-green" onClick="ajax_submit_form('addEditGoodsForm','{:U('Destine/addeditGoods?is_ajax=1')}');">确认提交</a>
            </div>
        </div> 
     </form>
    <!--表单数据-->
</div>
<div id="goTop"> <a href="JavaScript:void(0);" id="btntop"><i class="fa fa-angle-up"></i></a><a href="JavaScript:void(0);" id="btnbottom"><i class="fa fa-angle-down"></i></a></div>
<script>
    // 物流设置相 关
     $(document).ready(function(){
        $(":checkbox[cka]").click(function(){
            var $cks = $(":checkbox[ck='"+$(this).attr("cka")+"']");
            if($(this).is(':checked')){
                $cks.each(function(){$(this).prop("checked",true);});
            }else{
                $cks.each(function(){$(this).removeAttr('checked');});
            }
        });
    });
    // 物流设置相 关
    function choosebox(o){
        var vt = $(o).is(':checked');
        if(vt){
            $('input[type=checkbox]').prop('checked',vt);
        }else{
            $('input[type=checkbox]').removeAttr('checked');
        }
    }
    /*
     * 以下是图片上传方法
     */
    // 上传商品图片成功回调函数
    function call_back(fileurl_tmp){
        $("#original_img").val(fileurl_tmp);
    	$("#original_img2").attr('href', fileurl_tmp);
    }
 
    // 上传商品相册回调函数
    function call_back2(paths){
        
        var  last_div = $(".goods_xc:last").prop("outerHTML");	
        for (i=0;i<paths.length ;i++ )
        {                    
            $(".goods_xc:eq(0)").before(last_div);	// 插入一个 新图片
                $(".goods_xc:eq(0)").find('a:eq(0)').attr('href',paths[i]).attr('onclick','').attr('target', "_blank");// 修改他的链接地址
            $(".goods_xc:eq(0)").find('img').attr('src',paths[i]);// 修改他的图片路径
                $(".goods_xc:eq(0)").find('a:eq(1)').attr('onclick',"ClearPicArr2(this,'"+paths[i]+"')").text('删除');
            $(".goods_xc:eq(0)").find('input').val(paths[i]); // 设置隐藏域 要提交的值
        } 			   
    }
    /*
     * 上传之后删除组图input     
     * @access   public
     * @val      string  删除的图片input
     */
    function ClearPicArr2(obj,path)
    {
    	$.ajax({
                    type:'GET',
                    url:"{:U('Admin/Uploadify/delupload')}",
                    data:{action:"del", filename:path},
                    success:function(){
                           $(obj).parent().remove(); // 删除完服务器的, 再删除 html上的图片				 
                    }
		});
		// 删除数据库记录
    	$.ajax({
                    type:'GET',
                    url:"{:U('Admin/Goods/del_goods_images')}",
                    data:{filename:path},
                    success:function(){
                          //		 
                    }
		});		
    }
    
    
    
    // 上传荣誉证书回调函数
    function call_back3(paths){
        
        var  last_div = $(".goods_xc_honor:last").prop("outerHTML");	
        for (i=0;i<paths.length ;i++ )
        {                    
            $(".goods_xc_honor:eq(0)").before(last_div);	// 插入一个 新图片
                $(".goods_xc_honor:eq(0)").find('a:eq(0)').attr('href',paths[i]).attr('onclick','').attr('target', "_blank");// 修改他的链接地址
            $(".goods_xc_honor:eq(0)").find('img').attr('src',paths[i]);// 修改他的图片路径
                $(".goods_xc_honor:eq(0)").find('a:eq(1)').attr('onclick',"ClearPicArr2(this,'"+paths[i]+"')").text('删除');
            $(".goods_xc_honor:eq(0)").find('input').val(paths[i]); // 设置隐藏域 要提交的值
        } 			   
    }
    /*
     * 上传之后删除组图input     
     * @access   public
     * @val      string  删除的图片input
     */
    function ClearPicArr3(obj,path)
    {
    	$.ajax({
                    type:'GET',
                    url:"{:U('Admin/Uploadify/delupload')}",
                    data:{action:"del", filename:path},
                    success:function(){
                           $(obj).parent().remove(); // 删除完服务器的, 再删除 html上的图片				 
                    }
		});
	}

 
    $(document).ready(function(){
     
        //插件切换列表
        $('.tab-base').find('.tab').click(function(){
            $('.tab-base').find('.tab').each(function(){
                $(this).removeClass('current');
            });
            $(this).addClass('current');
			var tab_index = $(this).data('index');			
			$(".tab_div_1, .tab_div_2, .tab_div_3, .tab_div_4").hide();			
			$(".tab_div_"+tab_index).show();
		});		
            
    });
</script>		
</body>
</html>